MsgN("-- mdrp_client.lua loaded")

--include("client/spawnmenu.lua")

surface.CreateFont("Tahoma", 32, 400, true, false, "MDRPInventoryText32")


local meta = FindMetaTable("Player")

function meta:IsAwake( ply )
	if !ply and !ply:IsValid() then return false end

	return (ply:GetNWBool( "Awake" ) or false)
end





















local info = {}

info.Harvest = 0
info.Lumber = 0
info.Survial = 0

function MDRP.GetInfo( um )
	info.Harvest = um:ReadLong()
	info.Lumber = um:ReadLong()
	info.Survial = um:ReadLong()
end


--hook to read info from the server
usermessage.Hook("MDRP.GetInfo", MDRP.GetInfo)


MDRP.Huds = function()
	if !MDRP.IsEnabled() then return end

	--draw.RoundedBox( Number Bordersize, Number X, Number Y, Number Width, Number Height, Table Color )
	draw.RoundedBox( 10, 10, 10, 130, 50, Color(255, 255, 255, 150) )

 	local texture = surface.GetTextureID( "gui/mdrp/mdrp_wood" )
 
	surface.SetTexture(texture)

	local woodCount = (LocalPlayer():GetNWInt("InventoryWood") or -1)

	surface.SetDrawColor(255,255,255,255) // Makes sure the image draws with all colors
	surface.DrawTexturedRect(15,5,64,64)

	draw.SimpleText( "x" .. woodCount, "MDRPInventoryText32", 130, 15, Color(0,0,0,255), TEXT_ALIGN_RIGHT, TEXT_ALIGN_RIGHT )
end


--add hud hook
hook.Add("HUDPaint", "MDRP.Huds", MDRP.Huds)